<?php
   header('Content-type: application/octet-stream');
    header('Content-Disposition: attachment; filename=' . $file);
    header('Content-Length: ' . strlen($result));
    echo $result;
    exit();  
?>